const inputDom = document.querySelector('input');

function debounce(callback, timeout = 1000) {
    let timeId;
    return function (param) {
        clearTimeout(timeId);
        timeId = setTimeout(() => {
            callback(param);
        }, timeout);

    }
}

inputDom.oninput = debounce(function (e) {
    console.log('改变了', e);
    const divDom = document.querySelector('div');
    divDom.innerText = e.target.value;
})